package com.dailyblue.java.io;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

// 字节数组输出流
public class DemoF {
    public static void main(String[] args) throws IOException {
        String str = "Hello,world!";
        byte[] bytes = str.getBytes();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        baos.write(bytes, 0, bytes.length);
        baos.flush();
        String s = new String(bytes);
        System.out.println(s);
        baos.close();
    }
}
